﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.AlfaDirectFolder
{
    /// <summary>
    /// ТАБЛИЦА «TRADES» - СДЕЛКИ
    /// Ключевое поле: trd_no
    /// </summary>
    class Trades : INotifyPropertyChanged
    {
        #region Private

        private long _trdNo;
        private long _ordNo;
        private string _accCode;
        private string _tsNo;
        private string _trdTypeCode;
        private string _bS;
        private int _qty;
        private double _price;
        private double _tsTime;
        private string _comments;
        private string _pCode;
        private string _placeCode;
        private double _netValue;
        private double _pl;
        private int _treaty;
        private int _paperNo;
        private int _paperRest;
        private string _accName;
        private string _ansiName;
        private string _placeName;
        private string _boardCode;

        #endregion

        #region Public

        /// <summary>
        /// Номер.
        /// </summary>
        public long TrdNo
        {
            get { return _trdNo; }
            set
            {
                if (_trdNo != value)
                    _trdNo = value;

                RaisePropertyChanged("TrdNo");
            }
        }
        /// <summary>
        /// Номер инициирующей заявки.
        /// </summary>
        public long OrdNo
        {
            get { return _ordNo; }
            set
            {
                if (_ordNo != value)
                    _ordNo = value;

                RaisePropertyChanged("OrdNo");
            }
        }
        /// <summary>
        /// Портфель.
        /// </summary>
        public string AccCode
        {
            get { return _accCode; }
            set
            {
                if (_accCode != value)
                    _accCode = value;

                RaisePropertyChanged("AccCode");
            }
        }
        /// <summary>
        /// Номер в торговой системе.
        /// </summary>
        public string TsNo
        {
            get { return _tsNo; }
            set
            {
                if (_tsNo != value)
                    _tsNo = value;

                RaisePropertyChanged("TsNo");
            }
        }
        /// <summary>
        /// Код типа.
        /// </summary>
        public string TrdTypeCode
        {
            get { return _trdTypeCode; }
            set
            {
                if (_trdTypeCode != value)
                    _trdTypeCode = value;

                RaisePropertyChanged("TrdTypeCode");
            }
        }
        /// <summary>
        /// Покупка/продажа.
        /// </summary>
        public string BS
        {
            get { return _bS; }
            set
            {
                if (_bS != value)
                    _bS = value;

                RaisePropertyChanged("BS");
            }
        }
        /// <summary>
        /// Количество.
        /// </summary>
        public int Qty
        {
            get { return _qty; }
            set
            {
                if (_qty != value)
                    _qty = value;

                RaisePropertyChanged("Qty");
            }
        }
        /// <summary>
        /// Цена.
        /// </summary>
        public double Price
        {
            get { return _price; }
            set
            {
                if (_price != value)
                    _price = value;

                RaisePropertyChanged("Price");
            }
        }
        /// <summary>
        /// Время торговой системы.
        /// </summary>
        public double TsTime
        {
            get { return _tsTime; }
            set
            {
                if (_tsTime != value)
                    _tsTime = value;

                RaisePropertyChanged("TsTime");
            }
        }
        /// <summary>
        /// Комментарии.
        /// </summary>
        public string Comments
        {
            get { return _comments; }
            set
            {
                if (_comments != value)
                    _comments = value;

                RaisePropertyChanged("Comments");
            }
        }
        /// <summary>
        /// Код актива.
        /// </summary>
        public string PCode
        {
            get { return _pCode; }
            set
            {
                if (_pCode != value)
                    _pCode = value;

                RaisePropertyChanged("PCode");
            }
        }
        /// <summary>
        /// Код рынка.
        /// </summary>
        public string PlaceCode
        {
            get { return _placeCode; }
            set
            {
                if (_placeCode != value)
                    _placeCode = value;

                RaisePropertyChanged("PlaceCode");
            }
        }
        /// <summary>
        /// Всего.
        /// </summary>
        public double NetValue
        {
            get { return _netValue; }
            set
            {
                if (_netValue != value)
                    _netValue = value;

                RaisePropertyChanged("NetValue");
            }
        }
        /// <summary>
        /// Прибыль/убыток.
        /// </summary>
        public double Pl
        {
            get { return _pl; }
            set
            {
                if (_pl != value)
                    _pl = value;

                RaisePropertyChanged("Pl");
            }
        }
        /// <summary>
        /// Счет.
        /// </summary>
        public int Treaty
        {
            get { return _treaty; }
            set
            {
                if (_treaty != value)
                    _treaty = value;

                RaisePropertyChanged("Treaty");
            }
        }
        /// <summary>
        /// Код инструмента.
        /// </summary>
        public int PaperNo
        {
            get { return _paperNo; }
            set
            {
                if (_paperNo != value)
                    _paperNo = value;

                RaisePropertyChanged("PaperNo");
            }
        }
        /// <summary>
        /// Остаток.
        /// </summary>
        public int PaperRest
        {
            get { return _paperRest; }
            set
            {
                if (_paperRest != value)
                    _paperRest = value;

                RaisePropertyChanged("PaperRest");
            }
        }
        /// <summary>
        /// Название портфеля.
        /// </summary>
        public string AccName
        {
            get { return _accName; }
            set
            {
                if (_accName != value)
                    _accName = value;

                RaisePropertyChanged("AccName");
            }
        }
        /// <summary>
        /// Короткое название.
        /// </summary>
        public string AnsiName
        {
            get { return _ansiName; }
            set
            {
                if (_ansiName != value)
                    _ansiName = value;

                RaisePropertyChanged("AnsiName");
            }
        }
        /// <summary>
        /// Название рынка.
        /// </summary>
        public string PlaceName
        {
            get { return _placeName; }
            set
            {
                if (_placeName != value)
                    _placeName = value;

                RaisePropertyChanged("PlaceName");
            }
        }
        /// <summary>
        /// Код торгового раздела.
        /// </summary>
        public string BoardCode
        {
            get { return _boardCode; }
            set
            {
                if (_boardCode != value)
                    _boardCode = value;

                RaisePropertyChanged("BoardCode");
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
